package com.ccl.iot.dvr.utils;

import java.io.File;

public class FileUtil {

	/**
	 * 生成文件夹
	 * 
	 * @param filePath
	 */
	public static void makeRootDirectory(String filePath) {
		File file = null;
		try {
			file = new File(filePath);
			if (!file.exists()) {
				file.mkdir();
			}
		} catch (Exception e) {
		}
	}

	/**
	 * 生成文件
	 * @param filePath
	 * @param fileName
	 * @return
	 */
	public static File makeFilePath(String filePath, String fileName) {
		File file = null;
		makeRootDirectory(filePath);
		try {
			file = new File(filePath + fileName);
			if (!file.exists()) {
				file.createNewFile();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return file;
	}
}
